package DMDE.model.tests;

import static org.junit.Assert.*;
import main.java.DMDE.model.Parameter;
import main.java.DMDE.model.Type;

import org.junit.Before;
import org.junit.Test;

public class ParameterTestCase {

    private static final String TEST_PARAM_TYPE = "int";
    private static final String TEST_PARAM_NAME = "number";
    
    private Parameter parameter;
    private Type type;
    
    
    @Before
    public void setUp(){
	type = new Type(TEST_PARAM_TYPE);
	parameter = new Parameter(type, TEST_PARAM_NAME);
    }
    
    @Test
    public void testName() {
	assertEquals(TEST_PARAM_NAME,parameter.getName());
	parameter.setName("newName");
	assertEquals("newName",parameter.getName());	
    }
  
    @Test
    public void testType() {
	assertEquals(type,parameter.getType());
	Type newType = new Type("String");
	parameter.setType(newType);
	assertEquals(newType,parameter.getType());	
    }
    
    @Test
    public void testSameParameter() {
	parameter.setName("name");
	Parameter parameter2 = new Parameter(type, "name");
	assertTrue(parameter.is(parameter2));
    }

}
